IBM Support

Element already has a branch of type

Troubleshooting


Problem

This technote explains why an IBM Rational ClearCase view fails to checkout or add to source control and reports the error, Element already has a branch of type, along with steps to resolve the problem.

Symptom

Attempts to perform a checkout results in the following error:

%>cleartool co -nc a.txt
Created branch "branch" from "a.txt" version "\main\1".
cleartool: Error: Element already has a branch of type "branch" ("\main\branch").
cleartool: Error: Unable to create branch requested by -mkbranch option in config spec.
cleartool: Error: Unable to check out "a.txt".

Cause

Possible Causes







Cause 1

This error is caused by the view server and VOB server time not being in sync.

If the time (clock) on the VOB server is greater then the view server this error will happen as the version is created with a time stamp that is seen as in the future by the view server and thus will not be loaded (snapshot view only).


See Solution 1 for resolution.


Cause 2

This error can happen when using ClearCase on a VMware® hosted machine.

The cause of the error is related to the time setting on the VMware server. If the time on the VMware server is behind that of the VOB server, then the mkbranch error will occur.


See Solution 2 for resolution.


Cause 3

The error will occur due to a number of config spec syntax problems:

  • Incorrect spelling of scope, pattern, or version-selectors. For example CHECKEDOUT or LATEST or label names or branch names
  • Incorrect ordering of the scope, pattern, or version-selector. For example forgetting to include a LATEST rule that references a -mkbranch rule.
  • Metadata "types" not created but referenced in config spec. For example a -mkbranch rule referencing a branch type that does not exist.
  • A directory is listed using windows style slashes("\" instead"/" ) in Unix/Linux systems


    Example #1:

    element * CHECKEDOUT
    element * .../branch_name/
    Latest
    element * /main/LATEST -mkbranch branch_name
    load \VOB_TAG

    Note: The "Latest" reference in the second line is incorrect.



    Example #2:

    element * CHECKEDOUT
    element * V0.12.2 -mkbranch fax_12_20
    element * /main/integration/LATEST
    element * /main/LATEST -mkbranch integration


    Note:
    With the following element...

    test.txt@@\main
    test.txt@@\main\0
    test.txt@@\main\Integration
    test.txt@@\main\Integration\0
    test.txt@@\main\Integration\1
    test.txt@@\main\Integration\2
    test.txt@@\main\Integration\3 (V0.12.2)


    ... ClearCase is looking to the version test.txt@@\main\Integration\3 because there is the V0.12.2 label (rule 2 in the config spec). Now if a checkout is performed, ClearCase will parse the config spec and find rule 2, so it creates the branch fax_12_20 and then re-parses the config_spec from the beginning. Herein lies the problem, there is no rule specified to view any created version on this branch, so the first valid rule ClearCase finds is rule 2 again. When ClearCase tries to create the branch again, the error results because the branch already exists.

    Example #3:

    Another cause is a missing rule for the version that has to be selected after the branch is created which may be the issue if you find that most files can be checked out and only some generate the following errors.



    /view/developer1 : src =>ct co -nc digital_core.v
    cleartool: Error: Branch "/main/integration" already has sub-branch "developer1".
    cleartool: Error: Unable to create branch requested by -mkbranch option in config spec.
    cleartool: Error: Unable to check out "digital_core.v".

    Using this config spec:
    element * CHECKEDOUT
    element * /main/developer1/LATEST
    element * BUGCHECKLABEL -mkbranch developer1

    Here the config spec is correct, however, it is only valid for elements that have the label on a version on branch main. Once the new branch is created, the config spec is still selecting the version by LABEL. You can confirm that by having a look at the version tree.


See Solution 3 for resolution.



Cause 4

In one case, the exporting VOB had been moved from one host to another. Instead of following the move procedure outlined in the Administration Guide, the VOB was copied to the new host. This left the VOB active in two places. One developer created a branch type in the original location. After starting to work with the copied VOB at the new location, the developer detected that the copy did not contain the latest mkbranch operation. The developer decided to run the mkbranch operation again.

The importing site got the synchronization update packet with the first mkbranch event and imported it.

Then the packet with the second mkbranch event arrived but could not be imported because the branch already exists; hence the error.

For more information on how to restore a replica from backup follow the advice as described in the MultiSite Administration Manual.


See Solution 4 for resolution.

Resolving The Problem



Solution 1

Correct the time on the view and VOB server so they are in sync.

Review the operating system instructions on how to modify the system time.

Solution 2

Ensure the time on the VMware server is in sync with the VOB server.



The following command is one method that may be used on the VMware server to synchronize the time with that on the VOB server.
    net time \\vob_server_name /set

Consult the VMware User's Manual for more information on synchronizing time between VMware and other hosts.




Solution 3

Ensure the syntax is correct in the config spec.

Example #1: The solution is to change Latest to LATEST.

    element * CHECKEDOUT
    element * .../branch_name/
    LATEST
    element * /main/LATEST -mkbranch branch_name
    load \VOB_TAG

Example #2: The solution is to add a line between rule 1 and rule 2 (above) so that the new rule 2 will match the latest version on the new fax_12_20 branch thus preventing the recreation of the branch.
    element * CHECKEDOUT
    element * /main/.../fax_12_20/LATEST
    element * V0.12.2 -mkbranch fax_12_20
    element * /main/integration/LATEST
    element * /main/LATEST -mkbranch integration

Example #3: The solution is to change the config spec so that it will find all newly created branches, independent of the branch they are started from as in the sample below.

    element * CHECKEDOUT
    element * .../developer1/LATEST
    element * BUGCHECKLABEL -mkbranch developer1

For more information on the config spec and valid syntax, see the IBM Rational ClearCase Command Reference, or run cleartool man config_spec from command line.


Solution 4

This is divergence as both replicas, the sending and the receiving site, do not agree on the date and time of the mkbranch event.

One of the replicas will need to be removed and recreated. Which one to remove depends on the size of the replica family, the synchronization pattern in use and the willingness to lose data in that replica.

Review the MultiSite Administration Guide on the topic of Restoring and replacing VOB replicas for more details.

Also refer to the ClearCase MultiSite divergence - preventing and recovering from divergence white paper for further details about how to avoid divergence.



[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"View: Dynamic","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0.1.1;7.0.1;7.0.0.2;7.0.0.1;7.0;2003.06.16;2003.06.00","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"View: Snapshot","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"View: Snapshot","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21224441